<script setup lang="ts">
import CarFront from "~/components/person/CarFront.vue";
import type {VehiclePO} from "~/pojo/po/VehiclePO";
import CarBack from "~/components/person/CarBack.vue";
import CarSide from "~/components/person/CarSide.vue";

const role: string = useRoute().query.r as string

const carFrontURL: Ref<string> = ref('')
const carBackURL: Ref<string> = ref('')
const carSideURL: Ref<string> = ref('')
onMounted(function (): void {
  barTitleStore().setTitle('车辆信息')
  cFetch<VehiclePO>('/account/api/getVehicleInfo', {
    auth: true,
    defaultOpts: {
      method: 'POST',
    }
  }).then((res) => {
    carFrontURL.value = res.data[0].carFrontPhoto
    carBackURL.value = res.data[0].carBackPhoto
    carSideURL.value = res.data[0].carSidePhoto
  })
})

</script>

<template>
  <CarFront
      :car-front-photo-url="carFrontURL"
      :role="role"
  ></CarFront>
  <CarSide
      :car-side-photo-url="carSideURL"
  />
  <CarBack
      :role="role"
      :car-back-photo-url="carBackURL"
  />
</template>

<style scoped>

</style>